<!DOCTYPE HTML>
<html>
<head>
<script src="/js-test-resources/js-test.js"></script>
</head>
<body>
<div id="description"></div>
<div id="console"></div>
<script>
description("Test whether WebSocket aborts the connection when it receives an unexpected continuation frame without any leading text or binary frame.");

window.jsTestIsAsync = true;

var ws = new WebSocket("ws://127.0.0.1:8880/invalid-continuation");
var closeEvent;

ws.onopen = function()
{
    debug("onopen() was called.");
};

ws.onmessage = function(event)
{
    var message = event.data;
    testFailed("onmessage() was called. (message = \"" + message + "\")");
};

ws.onclose = function(event)
{
    debug("onclose() was called.");
    closeEvent = event;
    shouldBeFalse("closeEvent.wasClean");
    finishJSTest();
};

ws.onerror = function(errorEvent)
{
    testPassed("onerror() was called");
};

</script>
</body>
</html>
